From: Alexander Gavrilov <angavrilov@gmail.com>
To: "Paul Mackerras" <paulus@samba.org>
Cc: git@vger.kernel.org
Subject: [RFC PATCH (GITK)] gitk: Allow overriding the default commit.
Date: Sun, 3 Aug 2008 12:49:34 +0400 [thread overview]
Message-ID: <200808031249.35603.angavrilov@gmail.com> (raw)
In-Reply-To: <bb6f213e0807310541s383c2938q91543a1c57a4d71f@mail.gmail.com>
Date: Sun, 27 Jul 2008 08:18:27 +0400
Other GUI tools may occasionally need to start
gitk and make it automatically select a certain
commit. This patch supports doing it through the
environment or command line.
Using the environment allows graceful degradation of
the tool when used with an old version of gitk:
unsupported command line options cause it to die.
Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
On Thursday 31 July 2008 16:41:20 Alexander Gavrilov wrote:
> I have a patch WIP that allows specifying a commit on the command line
> to select instead of the head (I need it to enhance the git gui blame
> UI). It makes the function somewhat more intelligent. I'll submit it
> as soon as this series is sorted out.
I decided to send it now.
-- Alexander
gitk | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/gitk b/gitk
index d093a39..2da885d 100755
--- a/gitk
+++ b/gitk
@@ -416,10 +416,12 @@ proc stop_rev_list {view} {
}
proc reset_pending_select {selid} {
- global pending_select mainheadid
+ global pending_select mainheadid selectheadid
if {$selid ne {}} {
set pending_select $selid
+ } elseif {$selectheadid ne {}} {
+ set pending_select $selectheadid
} else {
set pending_select $mainheadid
}
@@ -1607,6 +1609,7 @@ proc getcommit {id} {
proc readrefs {} {
global tagids idtags headids idheads tagobjid
global otherrefids idotherrefs mainhead mainheadid
+ global selecthead selectheadid
foreach v {tagids idtags headids idheads otherrefids idotherrefs} {
catch {unset $v}
@@ -1653,6 +1656,12 @@ proc readrefs {} {
set mainhead [string range $thehead 11 end]
}
}
+ set selectheadid {}
+ if {$selecthead ne {}} {
+ catch {
+ set selectheadid [exec git rev-parse --verify $selecthead]
+ }
+ }
}
# skip over fake commits
@@ -9863,6 +9872,13 @@ if {![file isdirectory $gitdir]} {
exit 1
}
+set selecthead {}
+set selectheadid {}
+
+if {[info exists env(GITK_SELECT_ID)]} {
+ set selecthead $env(GITK_SELECT_ID)
+}
+
set revtreeargs {}
set cmdline_files {}
set i 0
@@ -9874,6 +9890,9 @@ foreach arg $argv {
set cmdline_files [lrange $argv [expr {$i + 1}] end]
break
}
+ "--select-commit=*" {
+ set selecthead [string range $arg 16 end]
+ }
"--argscmd=*" {
set revtreeargscmd [string range $arg 10 end]
}
@@ -9884,6 +9903,10 @@ foreach arg $argv {
incr i
}
+if {$selecthead eq "HEAD"} {
+ set selecthead {}
+}
+
if {$i >= [llength $argv] && $revtreeargs ne {}} {
# no -- on command line, but some arguments (other than --argscmd)
if {[catch {
--
1.5.6.3.18.gfe82
prev parent reply other threads:[~2008-08-03 8:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-27 6:17 [PATCH (GITK) 0/6] Runaway process and commit selection fixes Alexander Gavrilov
2008-07-27 6:18 ` [PATCH (GITK) 1/6] gitk: Kill back-end processes on window close Alexander Gavrilov
2008-07-27 6:19 ` [PATCH (GITK) 2/6] gitk: Register diff-files & diff-index in commfd, to ensure kill Alexander Gavrilov
2008-07-27 6:20 ` [PATCH (GITK) 3/6] gitk: On Windows use a Cygwin-specific flag for kill Alexander Gavrilov
2008-07-27 6:20 ` [PATCH (GITK) 4/6] gitk: Fixed broken exception handling in diff Alexander Gavrilov
2008-07-27 6:21 ` [PATCH (GITK) 5/6] gitk: Fixed automatic row selection during load Alexander Gavrilov
2008-07-27 6:22 ` [PATCH (GITK) 6/6] gitk: Fallback to selecting the head commit upon load Alexander Gavrilov
2008-07-31 11:25 ` [PATCH (GITK) 5/6] gitk: Fixed automatic row selection during load Paul Mackerras
2008-07-31 12:41 ` Alexander Gavrilov
2008-08-03 8:49 ` Alexander Gavrilov [this message]
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=200808031249.35603.angavrilov@gmail.com \
--to=angavrilov@gmail.com \
--cc=git@vger.kernel.org \
--cc=paulus@samba.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).