From patchwork Tue Jun 27 14:41:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71651EB64DD for ; Tue, 27 Jun 2023 14:42:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231672AbjF0OmE (ORCPT ); Tue, 27 Jun 2023 10:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231397AbjF0OmC (ORCPT ); Tue, 27 Jun 2023 10:42:02 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A33E35AE for ; Tue, 27 Jun 2023 07:41:33 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3fa9850bfd9so22316405e9.0 for ; Tue, 27 Jun 2023 07:41:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876887; x=1690468887; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Vvx70z2BXZ1jKRLTnGgIZScDPe0wQ43yxPzL6H+ZIhM=; b=aZDvpyvCBXRE2kuKPuka1idL0usKXKQWqOCH3Rx1oSVYwIRnPNJ2+Xo9iGr9/Cxsb7 7rDqv9AAcyiECJ3uuusAsczwRU8vXdcKU19Im5CTR0Z/SGr4eQSD2RUVXPTfzP0twxC/ Zb7fJJ95lCXkO+YpAkhtR81SBpDMoPf0eIFuyjQoLxIKAmq4ibZjSJudk1pOw+CADOTx o/XDuhHUFjcQllHcCPlBQ8XoyLgMpCyeJWXRDkiO9xdrTlF83FHn/WIh9amFyro9Lske kJj+scBCI9/qor6aJuFcLpSyeUnaWqBJ19M/jcejKvcadyUTbybVEk/xHGVeb7Av83IH 3o+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876887; x=1690468887; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vvx70z2BXZ1jKRLTnGgIZScDPe0wQ43yxPzL6H+ZIhM=; b=XoFJUlWc3jWEkz/TFjOtM1kCmYkzbT+0JBuhbz+ljsRUyNfihzkTkefP7m/f/7d2V/ /H0cXh0oAJD93nA9kH1HtwR0wfXMcRQp/V2B6phJ36xd4XyH/teQK9X6QTb3fIMdO2Hn qxWZC4PPvwoVqFGrwrgqgsj5dofK1ZL2bB+HiAJmLE7JY9TELEvm81IPm9vAz9bvQKSo 9xJKMsW5OFl3SSs7bqPiWKYeaAlwNLZjDS+h4JkFRtYlstzPHisIjeD+sG/urCjhMjfr UlWXWCU6ihQkzQNa6unc6VVVXh13jYZi1xxb1sK1BkdrBP4qbw2yt/Tin5fWs9PYukjW FNYw== X-Gm-Message-State: AC+VfDwjiwYo3xel7GGe1dsrJ5nkxrjFEocCDATdEdgrO4pXxw6Unh5X 9sbjNv9/MyVhNAjDgE4EUNH51UfOzwI= X-Google-Smtp-Source: ACHHUZ6nZPPVo6NnLGWvrx06UN4ic+aERjNvCCvh/kEiThcLJ6a8VsL6j42uiDdsxLAZpX7O7FCJtQ== X-Received: by 2002:a1c:4b0d:0:b0:3fa:e92e:7a8b with SMTP id y13-20020a1c4b0d000000b003fae92e7a8bmr3169540wma.13.1687876887432; Tue, 27 Jun 2023 07:41:27 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y19-20020a05600c365300b003fa8dbb7b5dsm7285618wmq.25.2023.06.27.07.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:27 -0700 (PDT) Message-Id: In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:16 +0000 Subject: [PATCH 1/9] gitk: add procedures to get commit info from selected row Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom These procedures are useful for implementing keyboard commands. Keyboard commands don't have access to commits that are selected by the mouse and hence must get info from the selected row. Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/gitk-git/gitk b/gitk-git/gitk index df3ba2ea99b..a533ff9002e 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -1333,6 +1333,24 @@ proc commitonrow {row} { return $id } +# Get commits ID of the row that is selected in the GUI +proc selected_line_id {} { + global selectedline + return [commitonrow $selectedline] +} + +# Gets the first branch name of the row that is selected in the GUI, or the +# empty string if there is no branches on that commit. +proc selected_line_head {} { + global idheads + set id [selected_line_id] + if {[info exists idheads($id)]} { + return [lindex $idheads($id) 0] + } else { + return "" + } +} + proc closevarcs {v} { global varctok varccommits varcid parents children global cmitlisted commitidx vtokmod curview numcommits From patchwork Tue Jun 27 14:41:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E78A8EB64DC for ; Tue, 27 Jun 2023 14:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231723AbjF0OmG (ORCPT ); Tue, 27 Jun 2023 10:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjF0OmD (ORCPT ); Tue, 27 Jun 2023 10:42:03 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3208A35AC for ; Tue, 27 Jun 2023 07:41:34 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4fb7dc16ff0so1916048e87.2 for ; Tue, 27 Jun 2023 07:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876889; x=1690468889; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=sdTuqlsYN96z5Q+SCaRUCk9MnIkkeIkfW12kJhnD1hM=; b=fqMT5ByNqaqFLJKi3GDfdlk2HnVyVgJI81mk2OYBjXcu1bhA8A/9s8MUIodVk0citH hySeGSHfrkoNDww24810A/6E6Dsb17hWb7OHkSsEB0q7pqLNYvtnu6UVme/gPR0iwx9Z k9LnPYo+tZ2LZ+p5qL/6CxxTILCPZ++luGdRu0DWbYBSBi3fssV2BUAQQmzaFnhv5KxQ ZqThti57DJ6AvEkVGDX+HxlXZ5lITymMujA78pE8iPUWD/SVxkTh7tfqWTXVjeUWRG3M qsQHdoJPTqKzrzRn1m2xuOScSWSc9WC7dfkIRs23baftv2oQS9HO5SHfDOlLfDKzE6Qh 0B+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876889; x=1690468889; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sdTuqlsYN96z5Q+SCaRUCk9MnIkkeIkfW12kJhnD1hM=; b=IunilMbSnieYkYrc44XJA5tHYF2fY65nEr8n7A9FHfvlXXBy3wsjcstyyJvfXJ32A3 dGcS+Ic9rZnf8izZMmcM4+TF8+im7o5V+9tSHwLZGYvlp79KfXjQQb87B2tMY5HWJCEN cw8Ng6J84rkxlnRlOSW88lhjdfa9JX+1OtjRq4PzqRlTIBrWPtVKJjon+SC9FABJnv8k 2lCkf61goZO74/dsP3+c5ubdBTEULTvbjnd2L1OyfLLBjqd3ph3kBWJ8b7UXnXnonLav fdsd3TrLFUeZD7/9EW158Cbs/Eb2le2YEteFwE32eTVfIjXU1+Yxl5EdjKIZLU0NKJuc YuyQ== X-Gm-Message-State: AC+VfDyMDumiyoen0JS5vZkvbHkTJOz5tPtwUVAQNaTbnE+V7nZHorU4 MNtgisMSeP4iv0AMEAyZf0WoJNadnCo= X-Google-Smtp-Source: ACHHUZ4QHypHVPVCQkXZfdiiLFLXZpR4a785v3O/MtB/Ib0nXX1Z3jducZirwMQBVqnuXR8xS6x5Lw== X-Received: by 2002:a19:ca4a:0:b0:4f8:7897:55d9 with SMTP id h10-20020a19ca4a000000b004f8789755d9mr13135846lfj.53.1687876888321; Tue, 27 Jun 2023 07:41:28 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id e15-20020adfe7cf000000b0030fae360f14sm10637756wrn.68.2023.06.27.07.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:27 -0700 (PDT) Message-Id: <863fa3ee311482c990f396a7d5298a12c159e0ef.1687876885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:17 +0000 Subject: [PATCH 2/9] gitk: use term "current branch" in gui Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom This is the term that is used in the official documentation. Instead of "HEAD branch" which in not standard. Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index a533ff9002e..574a80fbcc2 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2693,7 +2693,7 @@ proc makewindow {} { {mc "Write commit to file" command writecommit} {mc "Create new branch" command mkbranch} {mc "Cherry-pick this commit" command cherrypick} - {mc "Reset HEAD branch to here" command resethead} + {mc "Reset current branch to here" command resethead} {mc "Mark this commit" command markhere} {mc "Return to mark" command gotomark} {mc "Find descendant of this and mark" command find_common_desc} From patchwork Tue Jun 27 14:41:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6C62EB64D9 for ; Tue, 27 Jun 2023 14:42:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231801AbjF0OmQ (ORCPT ); Tue, 27 Jun 2023 10:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231669AbjF0OmE (ORCPT ); Tue, 27 Jun 2023 10:42:04 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 839AC30E5 for ; Tue, 27 Jun 2023 07:41:34 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-3fb4146e8fcso14234105e9.0 for ; Tue, 27 Jun 2023 07:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876889; x=1690468889; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=jdkA237Rzq1Trv8pIbF8G3SN9IrNUiZENoyBh4/95tA=; b=m9V0Ytcd+fvgWldH6bwsJgKCvKRVgzT7UeAvZRrOItHT918uADsnSgeamtxXCjD5fs Oq1owBNZ4lQQcPMwfHpS4IpkW3lxXw+VEg80u8Oc/sMqlQUNzCb96haIABCRxXTlUCr8 +zTKNyxCLjTVKLEswjrf0YM7w9WgmyW73vCVk7N8RBylKZx2f9y4UpcF6lKGtvEoZ9iD YtUNK+UyqQ34+Jg3WWYJx3+vmGBDQqeaaWqBC2iwci6yjfszSiF0XuEzhftJZlTAHW4h bGiBvMVcY+AvCK55TjV2MsXKLGgNAd2d+WY6UHGyNQ1bt37gWBMjhT0WtTmQpiQtnG4c NnYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876889; x=1690468889; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jdkA237Rzq1Trv8pIbF8G3SN9IrNUiZENoyBh4/95tA=; b=ISetCo1QV5Cq4WTCNR6tZnl4YUhUzPJe/oncEBwB9uk8Pwf7H7wz0pK4jal/SacVOQ rbz/NnmcDihBExg84nWyX9H2f+W7kMS/rGeH3+jqqpZSP7x5MEwAO2OQL5CKUCh4oCg8 LhjLrt4CFRexrErWhvE8szkClv1lrY6Uo6FMbCXO5XWUS2jDJ8N2KoDTkjLPEZ7qUBIn 5QMOLum22IJHzZl8nx2/BP4/dNZiGjEIhvHqyhwyWy9NiRuIh9kCQUkrPe1+gKS8M+w6 4l8kobo8iI9Ppw55YedWWtyWmwsc9xD2y4jc1kS8t3Nm9anNl5gabAvGKPz3Eqob5IrM 8yvA== X-Gm-Message-State: AC+VfDz1rJWuSNSF9oEuFnWw8A8aYqh46VoR4o3qZEMFhwm1bBbXhG4w YbsYvp0s0wgdV4DGy9dRPwixIT0Xvws= X-Google-Smtp-Source: ACHHUZ5cCGXuCFpTwGnS+qv8Ll1iIuVeq3b2IR43XmNfVb+S/xtAylXoD6g3kKDj3HUFm3vHL98PmQ== X-Received: by 2002:a05:600c:4209:b0:3fa:955a:9291 with SMTP id x9-20020a05600c420900b003fa955a9291mr5710371wmh.9.1687876889196; Tue, 27 Jun 2023 07:41:29 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id s25-20020a7bc399000000b003fa96fe2bebsm6025981wmj.41.2023.06.27.07.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:28 -0700 (PDT) Message-Id: <2ba695bf94fcd8739e434d4c52f80468919d23c3.1687876885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:18 +0000 Subject: [PATCH 3/9] gitk: add keyboard bind for reset Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index 574a80fbcc2..99c6fb6a848 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2675,6 +2675,7 @@ proc makewindow {} { bind $ctext $ctxbut {pop_diff_menu %W %X %Y %x %y} bind $ctext {focus %W} bind $ctext <> rehighlight_search_results + bind . <$M1B-t> {resethead [selected_line_id]} for {set i 1} {$i < 10} {incr i} { bind . <$M1B-Key-$i> [list go_to_parent $i] } @@ -2693,7 +2694,7 @@ proc makewindow {} { {mc "Write commit to file" command writecommit} {mc "Create new branch" command mkbranch} {mc "Cherry-pick this commit" command cherrypick} - {mc "Reset current branch to here" command resethead} + {mc "Reset current branch to here" command {resethead $rowmenuid}} {mc "Mark this commit" command markhere} {mc "Return to mark" command gotomark} {mc "Find descendant of this and mark" command find_common_desc} @@ -3166,6 +3167,7 @@ proc keys {} { [mc "<%s-KP-> Decrease font size" $M1T] [mc "<%s-minus> Decrease font size" $M1T] [mc " Update"] +[mc "<%s-T> Reset current branch to selected commit" $M1T] " \ -justify left -bg $bgcolor -border 2 -relief groove pack $w.m -side top -fill both -padx 2 -pady 2 @@ -9859,8 +9861,13 @@ proc revert {} { notbusy revert } -proc resethead {} { - global mainhead rowmenuid confirm_ok resettype NS +proc resethead {reset_target_id} { + global headids mainhead confirm_ok resettype NS + + if {! [info exists headids($mainhead)]} { + error_popup [mc "Cannot reset a detached head"] + return + } set confirm_ok 0 set w ".confirmreset" @@ -9868,7 +9875,7 @@ proc resethead {} { make_transient $w . wm title $w [mc "Confirm reset"] ${NS}::label $w.m -text \ - [mc "Reset branch %s to %s?" $mainhead [string range $rowmenuid 0 7]] + [mc "Reset branch %s to %s?" $mainhead [string range $reset_target_id 0 7]] pack $w.m -side top -fill x -padx 20 -pady 20 ${NS}::labelframe $w.f -text [mc "Reset type:"] set resettype mixed @@ -9891,13 +9898,13 @@ proc resethead {} { tkwait window $w if {!$confirm_ok} return if {[catch {set fd [open \ - [list | git reset --$resettype $rowmenuid 2>@1] r]} err]} { + [list | git reset --$resettype $reset_target_id 2>@1] r]} err]} { error_popup $err } else { dohidelocalchanges filerun $fd [list readresetstat $fd] nowbusy reset [mc "Resetting"] - selbyid $rowmenuid + selbyid $reset_target_id } } From patchwork Tue Jun 27 14:41:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294622 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D984EB64DD for ; Tue, 27 Jun 2023 14:42:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231771AbjF0OmS (ORCPT ); Tue, 27 Jun 2023 10:42:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231720AbjF0OmF (ORCPT ); Tue, 27 Jun 2023 10:42:05 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FEFE35BD for ; Tue, 27 Jun 2023 07:41:37 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-313e2fdd186so4027666f8f.2 for ; Tue, 27 Jun 2023 07:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876890; x=1690468890; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=zWXefmHQ4saLUx3VcnUQf83Pww53JFkH6r2lyDyWbJA=; b=bPFtGmJUajI2ipn0cR14ke/MxOQM19iyz2U1hjK6w7qoLHlzGuWZASVbKW1Jiy6j8T k0d7ZS5ft0DLNUyCKoXXHlkuRVa5ENMDqEO9BbT9t2OrONy44ChoRhyt0f/WJKTBIRjA 5OitxgtC6qd1l3PSBFC30K8RSUqndQpPOaw3gcl02KYPwTLp191qgkjPjVlJNpXJmvFP IlQV6g+gqo9omjOwOrUhwotY1m5HN9Gn6pCjZQFhcpqMe5DRktaLDvBr1t8BBkwIwoBO Ka2fW5fG36zx9oCFAyLDGONqmJDtV8+nfqPG1dyQvphaxiVQX0T/DEwaph3P6lOcZHEK t/dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876890; x=1690468890; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zWXefmHQ4saLUx3VcnUQf83Pww53JFkH6r2lyDyWbJA=; b=cmDJGoVGrv4a/dqRGYM2HW3ryfx7vMzoG+rYlfO0focsPPSrwa7XKzNpLM3bsEOPjR CPxQX7/kUg8AbgJHRUhlVkV4i3RuGhqRpT6BMdgjSrQ8H2P9fJRi22AX+BGm/P++C3RC IuEuo4gDIWpkBf/cob7bJ89mMbxoysnhGlkBT+bGjdPvWX8l1Y/NdyhiMPuUOoDZUAK7 7n49S9a2IuI+EqaiWajQh8jEj57fsRbHuU4Ko4rykM00GHs2eZZqInjexXGAFe5DQtZs bqF/mc3aPkdSBzyasn9LKZ3MAy4ckRCHNvqLceFI9GVvM+ZL4qex8Afpzu/2evkCB7uK 7Ddg== X-Gm-Message-State: AC+VfDxduNNxZv+JWLS+mxsDq9aQO/Uc8M7bqlBdnEDOqAqRaU2eRsFq PtPWDAgyq6KVqYxSJZC4H3bL347x/+U= X-Google-Smtp-Source: ACHHUZ7fkspctYY02KMOd/GL/+JniKgBEx69EjmpAwtC7HAZ0v1QVczM/NcNJD7Fxvegq/gOgGxHvQ== X-Received: by 2002:a5d:424d:0:b0:313:f2c6:a4f1 with SMTP id s13-20020a5d424d000000b00313f2c6a4f1mr4713640wrr.36.1687876889691; Tue, 27 Jun 2023 07:41:29 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x11-20020adfdd8b000000b00313ecd3714csm7768968wrl.19.2023.06.27.07.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:29 -0700 (PDT) Message-Id: <8594e2cc68a9b2d3dad1832dbc46d3718c68f84e.1687876885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:19 +0000 Subject: [PATCH 4/9] gitk: show branch name in reset dialog Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index 99c6fb6a848..bfe912983f4 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -1351,6 +1351,21 @@ proc selected_line_head {} { } } +# If any branch is associated with the argument ID then return that. Otherwise +# return the ID itself. Useful for displaying the best name of a commit. +proc commit_name {id should_shorten_id} { + global idheads idtags + if {[info exists idheads($id)]} { + return [lindex $idheads($id) 0] + } elseif {[info exists idtags($id)]} { + return [lindex $idtags($id) 0] + } elseif {$should_shorten_id} { + return [string range $id 0 7] + } else { + return $id + } +} + proc closevarcs {v} { global varctok varccommits varcid parents children global cmitlisted commitidx vtokmod curview numcommits @@ -9875,7 +9890,7 @@ proc resethead {reset_target_id} { make_transient $w . wm title $w [mc "Confirm reset"] ${NS}::label $w.m -text \ - [mc "Reset branch %s to %s?" $mainhead [string range $reset_target_id 0 7]] + [mc "Reset branch %s to %s?" $mainhead [commit_name $reset_target_id 1]] pack $w.m -side top -fill x -padx 20 -pady 20 ${NS}::labelframe $w.f -text [mc "Reset type:"] set resettype mixed From patchwork Tue Jun 27 14:41:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294623 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E75A5EB64D9 for ; Tue, 27 Jun 2023 14:42:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231795AbjF0OmT (ORCPT ); Tue, 27 Jun 2023 10:42:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231739AbjF0OmO (ORCPT ); Tue, 27 Jun 2023 10:42:14 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0C5D35BE for ; Tue, 27 Jun 2023 07:41:37 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fa70ec8d17so50395555e9.1 for ; Tue, 27 Jun 2023 07:41:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876890; x=1690468890; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=qmRGhfTFTgyv3gCMw9rHpmBd4iEYbjd9YzwQacRDRtQ=; b=sb4WxIGj2M/G5aB6cyeaVUcx+oaUXQXODEuE/bQJRPmtDInoHz3OjL6fhgIGG9HYY5 iE7iZKckT2O7mr3xhWbLSyJOBjK8ICEKRNKxfgxavnUnyUcmOoiisabttR1zwvlc7elf 0wwIeC5kAHTeKLM8KNCPcRQI2Xz/v61Cv/vSC4jSTI+e44UnwNQ/PyptHvtlkgOjGzsU +Tds8QkYX/Tu5tf/ki35Wpeg2HU7VCuidJP4KmtHVOaYsOnCoElksK1hyeoAfTbaQYud QjlCp9INr1HwRUEV+yukm+CF/xdFvt8I6KJo95WJ1NoLNnRsS09Zz6KTn0E/ev5WZ+ei qZpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876890; x=1690468890; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qmRGhfTFTgyv3gCMw9rHpmBd4iEYbjd9YzwQacRDRtQ=; b=FEqBqiY8jKX7YTNUzfWzdguuNat0icNt/lxzHvI56IrdTeTPhgLkB4hipffiklG1J9 p56UfOvPLp/7+pgVjEysXfqDfij5fE1qpx2H9IxoRFkfEg2KF1OBU4pIIAixQcPszEd+ XHSmUSC5HABhqg282GEJEQtv2ERadAE3ciZ3JqPZ5Z9yj1ceiUp3gLK1GRTlVdRKHKE2 AF8Q24jOqmrcmQGEIMlnmuP7fu0LVvPko4ZIqLUaQsgICeOzy8aEQUOt0+Uk4jiMwaQk SpNOXi+L+thPe0jGqV8HSSRdT5m40RkKDDp6nLlE4Mv8esFpW9UBXZ6PsgOTLNZSGY65 KLmQ== X-Gm-Message-State: AC+VfDxp8xCi9LE/W+QkgpI99OO6/qwNyBsHRclBmeT1ST1X9xOtpo1x dOAXN9qz1rRcg9agJheq5K6toXGB+a4= X-Google-Smtp-Source: ACHHUZ755JS2KZou1pMo4Xixrb7Bn5LCc6U0kUciieS0BW3HNdNs3wJHpXuT+Pi8stLM88mU9ybGfw== X-Received: by 2002:a1c:f616:0:b0:3f6:d90:3db with SMTP id w22-20020a1cf616000000b003f60d9003dbmr29686213wmc.3.1687876890181; Tue, 27 Jun 2023 07:41:30 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f21-20020a7bcd15000000b003f8140763c7sm10965942wmj.30.2023.06.27.07.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:29 -0700 (PDT) Message-Id: <53e5a2e40abbf81e5577b2f79588bd8b0be6e923.1687876885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:20 +0000 Subject: [PATCH 5/9] gitk: add keyboard bind for checkout Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom This also introduces the ability to check out detatched heads. This shouldn't result any problems, because gitk already works with detatched heads if they are checked out using the terminal. Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index bfe912983f4..596977abe89 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2691,6 +2691,7 @@ proc makewindow {} { bind $ctext {focus %W} bind $ctext <> rehighlight_search_results bind . <$M1B-t> {resethead [selected_line_id]} + bind . <$M1B-o> {checkout [selected_line_head] [selected_line_id]} for {set i 1} {$i < 10} {incr i} { bind . <$M1B-Key-$i> [list go_to_parent $i] } @@ -2707,7 +2708,7 @@ proc makewindow {} { {mc "Create tag" command mktag} {mc "Copy commit reference" command copyreference} {mc "Write commit to file" command writecommit} - {mc "Create new branch" command mkbranch} + {mc "Create new branch" command {mkbranch $rowmenuid}} {mc "Cherry-pick this commit" command cherrypick} {mc "Reset current branch to here" command {resethead $rowmenuid}} {mc "Mark this commit" command markhere} @@ -2732,7 +2733,7 @@ proc makewindow {} { set headctxmenu .headctxmenu makemenu $headctxmenu { - {mc "Check out this branch" command cobranch} + {mc "Check out this branch" command {checkout $headmenuhead $headmenuid}} {mc "Rename this branch" command mvbranch} {mc "Remove this branch" command rmbranch} {mc "Copy branch name" command {clipboard clear; clipboard append $headmenuhead}} @@ -3183,6 +3184,7 @@ proc keys {} { [mc "<%s-minus> Decrease font size" $M1T] [mc " Update"] [mc "<%s-T> Reset current branch to selected commit" $M1T] +[mc "<%s-O> Check out selected commit" $M1T] " \ -justify left -bg $bgcolor -border 2 -relief groove pack $w.m -side top -fill both -padx 2 -pady 2 @@ -9978,25 +9980,26 @@ proc headmenu {x y id head} { tk_popup $headctxmenu $x $y } -proc cobranch {} { - global headmenuid headmenuhead headids +proc checkout {newhead newheadid} { + global headids global showlocalchanges # check the tree is clean first?? - set newhead $headmenuhead + + # The ref is either the head, if it exists, or the ID + set newheadref [expr {$newhead ne "" ? $newhead : $newheadid}] + set command [list | git checkout] if {[string match "remotes/*" $newhead]} { set remote $newhead set newhead [string range $newhead [expr [string last / $newhead] + 1] end] - # The following check is redundant - the menu option should - # be disabled to begin with... if {[info exists headids($newhead)]} { error_popup [mc "A local branch named %s exists already" $newhead] return } lappend command -b $newhead --track $remote } else { - lappend command $newhead + lappend command $newheadref } lappend command 2>@1 nowbusy checkout [mc "Checking out"] @@ -10011,11 +10014,11 @@ proc cobranch {} { dodiffindex } } else { - filerun $fd [list readcheckoutstat $fd $newhead $headmenuid] + filerun $fd [list readcheckoutstat $fd $newhead $newheadref $newheadid] } } -proc readcheckoutstat {fd newhead newheadid} { +proc readcheckoutstat {fd newhead newheadref newheadid} { global mainhead mainheadid headids idheads showlocalchanges progresscoords global viewmainheadid curview @@ -10034,12 +10037,13 @@ proc readcheckoutstat {fd newhead newheadid} { return } set oldmainid $mainheadid - if {! [info exists headids($newhead)]} { + + if {$newhead ne "" && ! [info exists headids($newhead)]} { set headids($newhead) $newheadid lappend idheads($newheadid) $newhead addedhead $newheadid $newhead } - set mainhead $newhead + set mainhead $newheadref set mainheadid $newheadid set viewmainheadid($curview) $newheadid redrawtags $oldmainid From patchwork Tue Jun 27 14:41:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EEFDEB64DC for ; Tue, 27 Jun 2023 14:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231881AbjF0OmV (ORCPT ); Tue, 27 Jun 2023 10:42:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231781AbjF0OmP (ORCPT ); Tue, 27 Jun 2023 10:42:15 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 263363A94 for ; Tue, 27 Jun 2023 07:41:40 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f9b4a71623so44851395e9.1 for ; Tue, 27 Jun 2023 07:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876891; x=1690468891; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=xtZwrPQ71zSACQlxu1MCT7jaXoY0dh6FWGHeBrjCUh0=; b=Rc2v3feW8yS8MAqi3yuYojKsjrC8plxCkyENfEJlzIt8hDyQwC+tfxsvLla956jOl9 D0L8msw//31UAatjmgs2xWyscSTxHLFNQucFWaUOoqyxzE2GhZVVI+a8kMmoOvr7rGpX qCKTWQ5Kb7C+6XSsQzQICAtZ4cBEpoYKAveoviHAElXRUuGf8TA0iHrKj0+awpfZgGFv QQSXuRXQlWWCuerVd3ys4i+eY4k1BunNjNehkkeFOTY6AvM72ceMcQXm/kgi7cDpKL4n vIMljO6nOH33CqZF7CLUfLVvoDtqoglrunMO0KxBidnHH3zKtkK/wbyiiWpKMjlplzrJ a/TQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876891; x=1690468891; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xtZwrPQ71zSACQlxu1MCT7jaXoY0dh6FWGHeBrjCUh0=; b=RIcZgOnpPmXjWUfU2DPEWJVlDfBK5+V9O7bx6PMIkuAwbh2lTsywPXfhH+7bhM8S1h O1b9LsKA79Y78nxEsvN5if2701M6CldfwGrHU8Xy/cax7TLXJc0STaEGKjG+Jl8AJqzP wxIOssnjCFSmo9r0UIp5/Ks0lh7rtd5w+Ko+xp4ckV8vogeXju+cUIc9p3+TlbWIzFrt 8UIWgAAtB6swxZdLv/cOC+wU6uDzGghEGzgPjvpY45CJ1ld8iJ8V97s3eOkrASzNXUgT comuGCNsQ/XJN2EOZfdpDQ7VDhL4hRHMSrdltRH/BLjsMvRQxni+5zN4bg6LCHjFKha8 gkDA== X-Gm-Message-State: AC+VfDwLNz2I2mvY1+Z72D0D/9GorBWaRuakjoNqnvujvLSXYXtUeOVd EVZAIIFoHHoib/4w/f552v6WWkBwHZo= X-Google-Smtp-Source: ACHHUZ406lEeojlcgsnENBYOsIdCrJTRLq7h8NIm2BNOAWXWsTg4etAr/yVbX7BUomZw9ad8d5c4Ug== X-Received: by 2002:a05:600c:ac1:b0:3fb:a5b3:4f02 with SMTP id c1-20020a05600c0ac100b003fba5b34f02mr1412000wmr.36.1687876890978; Tue, 27 Jun 2023 07:41:30 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y12-20020a7bcd8c000000b003fa79af15c7sm14043778wmj.2.2023.06.27.07.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:30 -0700 (PDT) Message-Id: <661f098d882e64391ff76647e3764d58c6cbb50a.1687876885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:21 +0000 Subject: [PATCH 6/9] gitk: add keyboard bind for create and remove branch Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index 596977abe89..0d83a72a424 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2692,6 +2692,8 @@ proc makewindow {} { bind $ctext <> rehighlight_search_results bind . <$M1B-t> {resethead [selected_line_id]} bind . <$M1B-o> {checkout [selected_line_head] [selected_line_id]} + bind . <$M1B-m> {rmbranch [selected_line_head] [selected_line_id] 1} + bind . <$M1B-b> {mkbranch [selected_line_id]} for {set i 1} {$i < 10} {incr i} { bind . <$M1B-Key-$i> [list go_to_parent $i] } @@ -2735,7 +2737,7 @@ proc makewindow {} { makemenu $headctxmenu { {mc "Check out this branch" command {checkout $headmenuhead $headmenuid}} {mc "Rename this branch" command mvbranch} - {mc "Remove this branch" command rmbranch} + {mc "Remove this branch" command {rmbranch $headmenuhead $headmenuid 0}} {mc "Copy branch name" command {clipboard clear; clipboard append $headmenuhead}} } $headctxmenu configure -tearoff 0 @@ -3185,6 +3187,8 @@ proc keys {} { [mc " Update"] [mc "<%s-T> Reset current branch to selected commit" $M1T] [mc "<%s-O> Check out selected commit" $M1T] +[mc "<%s-C> Create branch on selected commit" $M1T] +[mc "<%s-M> Remove selected branch" $M1T] " \ -justify left -bg $bgcolor -border 2 -relief groove pack $w.m -side top -fill both -padx 2 -pady 2 @@ -9576,13 +9580,13 @@ proc wrcomcan {} { unset wrcomtop } -proc mkbranch {} { - global NS rowmenuid +proc mkbranch {id} { + global NS set top .branchdialog set val(name) "" - set val(id) $rowmenuid + set val(id) $id set val(command) [list mkbrgo $top] set ui(title) [mc "Create branch"] @@ -10054,13 +10058,14 @@ proc readcheckoutstat {fd newhead newheadref newheadid} { } } -proc rmbranch {} { - global headmenuid headmenuhead mainhead +proc rmbranch {head id shouldComfirm} { + global mainhead global idheads - - set head $headmenuhead - set id $headmenuid # this check shouldn't be needed any more... + if {$head eq ""} { + error_popup [mc "Cannot delete a detached head"] + return + } if {$head eq $mainhead} { error_popup [mc "Cannot delete the currently checked-out branch"] return @@ -10070,6 +10075,8 @@ proc rmbranch {} { # the stuff on this branch isn't on any other branch if {![confirm_popup [mc "The commits on branch %s aren't on any other\ branch.\nReally delete branch %s?" $head $head]]} return + } elseif {$shouldComfirm} { + if {![confirm_popup [mc "Really delete branch %s?" $head]]} return } nowbusy rmbranch update From patchwork Tue Jun 27 14:41:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A78EB64DC for ; Tue, 27 Jun 2023 14:42:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231727AbjF0Omh (ORCPT ); Tue, 27 Jun 2023 10:42:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbjF0OmS (ORCPT ); Tue, 27 Jun 2023 10:42:18 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68DF930D5 for ; Tue, 27 Jun 2023 07:41:54 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fa99742af9so21382855e9.2 for ; Tue, 27 Jun 2023 07:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876891; x=1690468891; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=LRoYwVHzSDwkYldlcFwgc+8SqgwvY7sM5nMQ6BpUX1A=; b=hJ9L5PKUV6gr76elZnBd4eHusDmrCY+390M9b8ErwN61VSvZyRxe6X8gay0bLwiz47 aFEsrjmXqt/xVCu4RzIApiFlNv5SsJjzcWvLwXd4KJfw+HGnhrbMNgd9f0yEMfgw9z/6 o4pBG/iKmdlgv925Xgz/WUmlB/wMxVmea31WMO1iiaV8cF5tyLhafFthVqM5yK095K5J 7SsQ0AzUwSm1jSfxEnse1P1tEoufIzBvNYPaM8soO+0aR4/+/+bX/2+/FtAszR6AsucB XFEBhPh7iKsgbN5QaTJX3vImnCSy4HvhduO7GE7yFg/EqATAQjShFIDLxxCjOSjPvH9u BHCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876891; x=1690468891; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LRoYwVHzSDwkYldlcFwgc+8SqgwvY7sM5nMQ6BpUX1A=; b=S/5Ni2yMSk/RWIRBxTH6F2yiBix+WdalH07qs0abm0/5+KplYdL7SZV80jWjudHk5b AwjSMPjkVzpo6SPLPCAPObpjQUmfGq+tk4Ff0whkkaH6IqM3ecROnVWWgSbVmDEPnPn9 4N/IXkzvMoJEvGNTn6x8Rb5vru2Ob3zhGJSFCaVeBHvv3c0vjuuUOezxL/+1MnMePff/ BAL/oUFN9WZ9+kBzJjpRynz7bVZWuPGt4S6+Jhmx/ACH464Il0LY7Dks8MASo/5MVq/W 8c24/ezsjbwRzq8Yq6KHjyRV8JwSfbnjl01aiyLd8ZEnd+oDr1i4REeQBdWaLXXDGU2f hYhA== X-Gm-Message-State: AC+VfDxjjxuywmevu+g4fkoqvuZQ5P9pxDJIBr+AvvGAZP++cwgx13dY 2HmIDCE6TUFc7t0RjM2apOhsOSmossM= X-Google-Smtp-Source: ACHHUZ7B/5gAt83NWsZxxlk7D+NwwqfihCuFArC7nAKHDYSHmS3eGsv4T4oduJpeQwK176rbszkY5A== X-Received: by 2002:a7b:ce12:0:b0:3fa:97ad:2ba5 with SMTP id m18-20020a7bce12000000b003fa97ad2ba5mr4194007wmc.31.1687876891632; Tue, 27 Jun 2023 07:41:31 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id m13-20020a7bcb8d000000b003fba97b1252sm1044431wmi.1.2023.06.27.07.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:31 -0700 (PDT) Message-Id: <46cbbaa6fe2a215e8b7f1e4f9b5c420d5850503c.1687876885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:22 +0000 Subject: [PATCH 7/9] gitk: add keyboard bind to cherry-pick Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index 0d83a72a424..5b01d1902a5 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2690,6 +2690,7 @@ proc makewindow {} { bind $ctext $ctxbut {pop_diff_menu %W %X %Y %x %y} bind $ctext {focus %W} bind $ctext <> rehighlight_search_results + bind . <$M1B-p> {cherrypick [selected_line_id]} bind . <$M1B-t> {resethead [selected_line_id]} bind . <$M1B-o> {checkout [selected_line_head] [selected_line_id]} bind . <$M1B-m> {rmbranch [selected_line_head] [selected_line_id] 1} @@ -2711,7 +2712,7 @@ proc makewindow {} { {mc "Copy commit reference" command copyreference} {mc "Write commit to file" command writecommit} {mc "Create new branch" command {mkbranch $rowmenuid}} - {mc "Cherry-pick this commit" command cherrypick} + {mc "Cherry-pick this commit" command {cherrypick $rowmenuid}} {mc "Reset current branch to here" command {resethead $rowmenuid}} {mc "Mark this commit" command markhere} {mc "Return to mark" command gotomark} @@ -3186,6 +3187,7 @@ proc keys {} { [mc "<%s-minus> Decrease font size" $M1T] [mc " Update"] [mc "<%s-T> Reset current branch to selected commit" $M1T] +[mc "<%s-P> Cherry-pick selected commit to current branch" $M1T] [mc "<%s-O> Check out selected commit" $M1T] [mc "<%s-C> Create branch on selected commit" $M1T] [mc "<%s-M> Remove selected branch" $M1T] @@ -9758,24 +9760,29 @@ proc exec_citool {tool_args {baseid {}}} { array set env $save_env } -proc cherrypick {} { - global rowmenuid curview +proc cherrypick {id} { + global curview headids global mainhead mainheadid global gitdir + if {! [info exists headids($mainhead)]} { + error_popup [mc "Cannot cherry-pick to a detached head"] + return + } + set oldhead [exec git rev-parse HEAD] - set dheads [descheads $rowmenuid] + set dheads [descheads $id] if {$dheads ne {} && [lsearch -exact $dheads $oldhead] >= 0} { set ok [confirm_popup [mc "Commit %s is already\ included in branch %s -- really re-apply it?" \ - [string range $rowmenuid 0 7] $mainhead]] + [string range $id 0 7] $mainhead]] if {!$ok} return } nowbusy cherrypick [mc "Cherry-picking"] update # Unfortunately git-cherry-pick writes stuff to stderr even when # no error occurs, and exec takes that as an indication of error... - if {[catch {exec sh -c "git cherry-pick -r $rowmenuid 2>&1"} err]} { + if {[catch {exec sh -c "git cherry-pick -r $id 2>&1"} err]} { notbusy cherrypick if {[regexp -line \ {Entry '(.*)' (would be overwritten by merge|not uptodate)} \ @@ -9791,7 +9798,7 @@ proc cherrypick {} { resolve it?"]]} { # Force citool to read MERGE_MSG file delete [file join $gitdir "GITGUI_MSG"] - exec_citool {} $rowmenuid + exec_citool {} $id } } else { error_popup $err From patchwork Tue Jun 27 14:41:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294626 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 639F8EB64DC for ; Tue, 27 Jun 2023 14:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231880AbjF0Omo (ORCPT ); Tue, 27 Jun 2023 10:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbjF0OmU (ORCPT ); Tue, 27 Jun 2023 10:42:20 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70E3F3582 for ; Tue, 27 Jun 2023 07:41:58 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-4f8777caaa1so6481959e87.3 for ; Tue, 27 Jun 2023 07:41:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876892; x=1690468892; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=ht+rV4DcAqrleOOAnzY385skI4mRGjd7B+agaw/btfM=; b=MWk7sW92c68dbWnuj9W1mnxQlioHEG+Uv7xQeRwrmWQ4djwXgvftCkzR0gBsqs0NZK WvRDxaWf2PRHEc/x+HKWhChzPPXlRQZa1spWO9e+d9Ca8+PnhySwWylBCEf/HYKETwga xWBSzLcsfJRyexSeZgKQMqvGL0wB1I4DtbjNgO7GDUTcwEAvNJ7nRhxAA9yo0rRc3xIo dzrII2Tk5kIHfcWO7BmX3MhdOc0Qa8j5FSi0TPfKuFuk6RV184ArjzZlCPiRNlYQXDPD H6/4401Cpx8MHKv8Sbyw5Dw3toTsaUGoR2fM7HknsvGe5m+oksU0vYEzbQkvHr5HTvtr hukQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876892; x=1690468892; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ht+rV4DcAqrleOOAnzY385skI4mRGjd7B+agaw/btfM=; b=Q6K/7n3vAaWmVjyDFod7ljgZsvsDQV5pwQsMWra0y9/TpRE4WK9vqVdjPfuzczurlD Ozl52K1UJPEiK0hqvsMSEo/VwXYLK6k7foxFpKSJ/FUYUV5KRomb7kDGKdiOe4gcwe9s q40AMKPAoYVnJfHyNvyc+a2Sz8jiGqDnuGtejN2SFQXmnz//I43n5WLR6mCg7muwMIeF hC7tAnS98FwXxqXAQ4F8zXZ2XIpi0lcjVeb0oV7RrwTg0rM0+9O2V2MjCnvWb4DeoBYf L6/n8Da8Nhskz5nsrZ3bywzbEAkEUAL4cYc8sk5NG+KCxyZnUPt+SwxysYWt9FBQxjTL ysBQ== X-Gm-Message-State: AC+VfDyqHTfTN79haaF7D9y7IbCfGt1YYWzBFTWJkN5+fHRfajATaHRR I2JpBEXo0jSmo/7Z1xHCibzD45pmld8= X-Google-Smtp-Source: ACHHUZ426BXfw3Zli8yCsC3KRb0jjt8EqoIFrQ+HHikqvtESWkvARRxs7vFXAE67cE7viy9Ayo/8DA== X-Received: by 2002:a19:500f:0:b0:4f8:6533:3341 with SMTP id e15-20020a19500f000000b004f865333341mr16619853lfb.20.1687876892086; Tue, 27 Jun 2023 07:41:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p8-20020a7bcc88000000b003fb225d414fsm4621719wma.21.2023.06.27.07.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:31 -0700 (PDT) Message-Id: <49cdbff270f30f91418dde5c704836f51e1e4f61.1687876885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:23 +0000 Subject: [PATCH 8/9] gitk: focus ok button in reset dialog Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom This is more convenient for users, especially when using keyboard commands. Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index 5b01d1902a5..9d93053e360 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -9922,7 +9922,7 @@ proc resethead {reset_target_id} { ${NS}::button $w.cancel -text [mc Cancel] -command "destroy $w" bind $w [list destroy $w] pack $w.cancel -side right -fill x -padx 20 -pady 20 - bind $w "grab $w; focus $w" + bind $w "grab $w; focus $w.ok" tkwait window $w if {!$confirm_ok} return if {[catch {set fd [open \ From patchwork Tue Jun 27 14:41:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jens_Lidestr=C3=B6m?= X-Patchwork-Id: 13294627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3992EB64D9 for ; Tue, 27 Jun 2023 14:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231946AbjF0Omq (ORCPT ); Tue, 27 Jun 2023 10:42:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231886AbjF0Oma (ORCPT ); Tue, 27 Jun 2023 10:42:30 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DA233596 for ; Tue, 27 Jun 2023 07:42:00 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3fa96fd7a01so27819705e9.1 for ; Tue, 27 Jun 2023 07:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687876892; x=1690468892; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=+qaYi+K5OhF4RahYkxc/5xaenw/adsZGzEPGSyzzc8Q=; b=bUIUfsP9zN+lnstICCxS5azx8hYGZGEvut1F6q0FJ7q+ZdjJdCwQcCz8BDiQMpl9KM TnLJ7J35NKR1gadMC7LSWFyo98hooQqomCP3iGknEgtn+EJsVVyWPPYsQRKCcjQ8YBaG 27VwPrlYCg7v9qJqxcFp04Mo/y0mszz8UgbGMRyiBJXJYL93R19BCIy2isN6qKzdSj9c GOACZkux3CxFg8RhObtaEbqqsvztDQX/kFX41sZZJzHmcBtvPeJnXUpNvOyXI/gUGLdw ZWk2uTbKVFvkzkZw5K/DPBW2YLOMWj5v/azvlnJAXJ91s/ms8G+A7My1o8CHsPqcZadT LKBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687876892; x=1690468892; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+qaYi+K5OhF4RahYkxc/5xaenw/adsZGzEPGSyzzc8Q=; b=W0LEIsZ4EMhcW+sx5EKpZ2PMXx0BQJVYhqQ0ib5kWIARFYw6XiLbMNIhKbzbvT84A1 NEmrYd1/83AjoTwDECXrbVV7qy8HUR2HL+rLkU1c2u9C5kB4zkIc5Gbf60wW1dOGHo3e 1g0I0YJs2vujCcu20b4X3sQY3sklZXnYXPLM3q094oN2Vow0Zb0ySHVH9F94Gt8XjW8t oAe9f9f5Vlgq1o0YlRgYcMkBenuBZyia35IVM/Ye+pEE70GxcNhXSVYhYJf49P5Cw+Sj vGe6/Q5z2VfsWKouz2MheUYSXd77Z2/7bTIZ5VcvfVSasUQNCwxJVObNM03041iYjGjR dNBQ== X-Gm-Message-State: AC+VfDzxq4w/sFdZSuJrXgW3+58alyr+LDIMuva8slHtCEYNbbNjPflm rMf1hou2rCXiauRKTjWawKoAq8rbjgc= X-Google-Smtp-Source: ACHHUZ7XuuvG+NbQGNN0leLdABueot+WzqRQKzDvuBMw/piPCaXZf7XIvSBBM/SVJCSbObD+PVR7Lg== X-Received: by 2002:a05:6000:1008:b0:30f:c1f5:e91e with SMTP id a8-20020a056000100800b0030fc1f5e91emr27542416wrx.27.1687876892549; Tue, 27 Jun 2023 07:41:32 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id o18-20020a056000011200b00313f9085119sm3329855wrx.113.2023.06.27.07.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 07:41:32 -0700 (PDT) Message-Id: <97857c3509fb4b45e1bc2d29588374a2631a7c2d.1687876885.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 27 Jun 2023 14:41:24 +0000 Subject: [PATCH 9/9] gitk: default select reset hard in dialog Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: "Paul Mackerras [ ]" , Jens Lidestrom , Jens Lidestrom Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Jens Lidestrom From: Jens Lidestrom Reset hard is dangerous but also the most common reset type, and not having it pre-selected in the dialog is annoying to users. It is also less dangerous in the GUI where there is a confirmation dialog. Also, dangling commits remain in the GUI and can be recovered. Signed-off-by: Jens Lidestrom --- gitk-git/gitk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gitk-git/gitk b/gitk-git/gitk index 9d93053e360..5b0a0ea46be 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -9906,7 +9906,9 @@ proc resethead {reset_target_id} { [mc "Reset branch %s to %s?" $mainhead [commit_name $reset_target_id 1]] pack $w.m -side top -fill x -padx 20 -pady 20 ${NS}::labelframe $w.f -text [mc "Reset type:"] - set resettype mixed + # Reset hard is dangerous but also the most common reset type, and not + # having it pre-selected in the dialog is annoying to users. + set resettype hard ${NS}::radiobutton $w.f.soft -value soft -variable resettype \ -text [mc "Soft: Leave working tree and index untouched"] grid $w.f.soft -sticky w