From: Yann Dirson <ydirson@altern.org>
To: Catalin Marinas <catalin.marinas@gmail.com>
Cc: git@vger.kernel.org
Subject: [PATCH 6/8] Add contrib/stg-gitk: helper script to run gitk
Date: Fri, 02 Mar 2007 00:04:05 +0100 [thread overview]
Message-ID: <20070301230405.32459.73120.stgit@gandelf.nowhere.earth> (raw)
In-Reply-To: <20070301225651.32459.89156.stgit@gandelf.nowhere.earth>
Signed-off-by: Yann Dirson <ydirson@altern.org>
---
contrib/stg-gitk | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/contrib/stg-gitk b/contrib/stg-gitk
new file mode 100755
index 0000000..dd01ef0
--- /dev/null
+++ b/contrib/stg-gitk
@@ -0,0 +1,61 @@
+#!/bin/sh
+set -e
+
+# stg-gitk - helper script to graphically display an StGIT stack
+
+# Displays given branches and stacks, without getting disturbed by
+# patch logs.
+
+# LIMITATIONS:
+# - asking gitk to "update" won't detect any new ref
+# - no support for spaces in branch names
+
+# Copyright (c) 2007 Yann Dirson <ydirson@altern.org>
+# Subject to the GNU GPL, version 2.
+
+usage()
+{
+ echo "Usage: $(basename $0) [<branches>|--all]"
+ exit 1
+}
+
+allbranches=0
+case "$1" in
+--all) allbranches=1; shift ;;
+--*) usage ;;
+*) break ;;
+esac
+
+if [ $allbranches = 1 ] && [ "$#" -gt 0 ]; then
+ usage
+fi
+
+GIT_DIR=$(git-rev-parse --git-dir)
+GIT_DIR_SPKIPLEN=$(printf "$GIT_DIR/X" | wc -c)
+
+refdirs=''
+if [ $allbranches = 1 ]; then
+ refdirs="$GIT_DIR/refs"
+else
+ if [ "$#" = 0 ]; then
+ set -- "$(stg branch)"
+ fi
+
+ for b in "$@"; do
+ if [ -e "$GIT_DIR/refs/patches/$b" ]; then
+ # StGIT branch: show all patches
+ refdirs="$refdirs $GIT_DIR/refs/heads/$b $GIT_DIR/refs/patches/$b"
+ elif [ -e "$GIT_DIR/refs/heads/$b" ]; then
+ # other GIT branch
+ refdirs="$refdirs $GIT_DIR/refs/heads/$b"
+ elif [ $(git-for-each-ref "refs/$b" | wc -l) != 0 ]; then
+ # other ref
+ refdirs="$refdirs $(git-for-each-ref --format="$GIT_DIR/%(refname)" "refs/$b")"
+ else
+ echo >&2 "ERROR: no such ref '$b'"
+ usage
+ fi
+ done
+fi
+
+gitk $(find $refdirs -type f -not -name '*.log' | cut -c${GIT_DIR_SPKIPLEN}- )
next prev parent reply other threads:[~2007-03-01 23:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-01 23:03 [PATCH 0/8] My set of stgit helper scripts (update) Yann Dirson
2007-03-01 23:03 ` [PATCH 1/8] Add contrib/stg-whatchanged: look at what would be changed by refreshing Yann Dirson
2007-03-01 23:03 ` [PATCH 2/8] Add contrib/stg-show-old: show old version of a patch Yann Dirson
2007-03-01 23:03 ` [PATCH 3/8] Add contrib/stg-fold-files-from: pick selected changes from a patch above current one Yann Dirson
2007-03-01 23:03 ` [PATCH 4/8] Add contrib/stg-swallow: completely merge an unapplied patch into " Yann Dirson
2007-03-01 23:04 ` [PATCH 5/8] Add contrib/stg-cvs: helper script to manage a mixed cvs/stgit working copy Yann Dirson
2007-03-01 23:04 ` Yann Dirson [this message]
2007-03-01 23:04 ` [PATCH 7/8] Add contrib/stg-mdiff: display diffs of diffs Yann Dirson
2007-03-01 23:04 ` [PATCH 8/8] Add contrib/stg-sink: sink a patch to given location (mirrors float) Yann Dirson
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=20070301230405.32459.73120.stgit@gandelf.nowhere.earth \
--to=ydirson@altern.org \
--cc=catalin.marinas@gmail.com \
--cc=git@vger.kernel.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).