git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alexander Gavrilov <angavrilov@gmail.com>
To: git@vger.kernel.org
Cc: Paul Mackerras <paulus@samba.org>,
	"Shawn O. Pearce" <spearce@spearce.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit.
Date: Sat, 23 Aug 2008 12:27:44 +0400	[thread overview]
Message-ID: <200808231227.45013.angavrilov@gmail.com> (raw)
In-Reply-To: <200808231225.12596.angavrilov@gmail.com>

Other GUI tools may occasionally need to start
gitk and make it automatically select a certain
commit. This patch supports doing it using a new
command-line option.

Signed-off-by: Alexander Gavrilov <angavrilov@gmail.com>
---
 gitk |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/gitk b/gitk
index 087c4ac..7698b70 100755
--- a/gitk
+++ b/gitk
@@ -418,10 +418,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
     }
@@ -1609,6 +1611,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}
@@ -1655,6 +1658,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
@@ -9865,6 +9874,9 @@ if {![file isdirectory $gitdir]} {
     exit 1
 }
 
+set selecthead {}
+set selectheadid {}
+
 set revtreeargs {}
 set cmdline_files {}
 set i 0
@@ -9876,6 +9888,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]
 	}
@@ -9886,6 +9901,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.6.0.rc2

  reply	other threads:[~2008-08-23  8:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-23  8:25 [PATCH (GITK,GIT-GUI,DOCS) 0/7] Improve gui blame and gitk integration Alexander Gavrilov
2008-08-23  8:27 ` Alexander Gavrilov [this message]
2008-08-23  8:29   ` [PATCH (GITK,GIT-GUI,DOCS) 2/7] gitk: Support calling git gui blame from gitk Alexander Gavrilov
2008-08-26 10:27     ` Paul Mackerras
2008-08-26 12:10       ` Johannes Sixt
2008-08-26 10:13   ` [PATCH (GITK,GIT-GUI,DOCS) 1/7] gitk: Allow overriding the default commit Paul Mackerras
2008-08-23  8:30 ` [PATCH (GITK,GIT-GUI,DOCS) 3/7] git-gui: Support starting gitk from Gui Blame Alexander Gavrilov
2008-08-23  8:30   ` [PATCH (GITK,GIT-GUI,DOCS) 4/7] git-gui: Support passing blame to a parent commit Alexander Gavrilov
2008-08-23  8:31     ` [PATCH (GITK,GIT-GUI,DOCS) 5/7] git-gui: Better positioning in Blame Parent Commit Alexander Gavrilov
2008-08-23  8:32       ` [PATCH (GITK,GIT-GUI,DOCS) 6/7] git-gui: Allow specifying an initial line for git gui blame Alexander Gavrilov
2008-08-25  5:06   ` [PATCH (GITK,GIT-GUI,DOCS) 3/7] git-gui: Support starting gitk from Gui Blame Shawn O. Pearce
2008-08-23  8:33 ` [PATCH (GITK,GIT-GUI,DOCS) 7/7] Document new options of gui tools Alexander Gavrilov

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200808231227.45013.angavrilov@gmail.com \
    --to=angavrilov@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=paulus@samba.org \
    --cc=spearce@spearce.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).