From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
To: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
Cc: git@vger.kernel.org, Peter Simons <simons@cryp.to>,
pasky@suse.cz, Per Cederqvist <ceder@lysator.liu.se>,
Olaf Dabrunz <odabrunz@gmx.net>,
Thomas Moschny <thomas.moschny@gmx.de>,
martin f krafft <madduck@madduck.net>,
Bert Wesarg <bert.wesarg@googlemail.com>
Subject: [TopGit PATCH 4/6] tg-prev/tg-next: commands to explore dependencies
Date: Sun, 3 Oct 2010 23:25:55 +0200 [thread overview]
Message-ID: <1286141157-30422-4-git-send-email-bert.wesarg@googlemail.com> (raw)
In-Reply-To: <1286141157-30422-3-git-send-email-bert.wesarg@googlemail.com>
Two new commands to explore the dependencies of TopGit branches:
a) tg prev [-i | -w] [NAME]
outputs the dependencies of NAME
b) tg next [-i | -w] [NAME]
outputs branches which depends on NAME
Obviously, quilt next was the inspiration.
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
.gitignore | 4 +++
README | 16 +++++++++++++++
contrib/tg-completion.bash | 34 +++++++++++++++++++++++++++++++++
tg-next.sh | 45 ++++++++++++++++++++++++++++++++++++++++++++
tg-prev.sh | 38 +++++++++++++++++++++++++++++++++++++
5 files changed, 137 insertions(+), 0 deletions(-)
diff --git a/.gitignore b/.gitignore
index 0342e09..fe4bdc1 100644 .gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -28,8 +28,12 @@
/tg-info.txt
/tg-mail
/tg-mail.txt
+/tg-next
+/tg-next.txt
/tg-patch
/tg-patch.txt
+/tg-prev
+/tg-prev.txt
/tg-push
/tg-push.txt
/tg-remote
diff --git a/README b/README
index f103d92..f2d18a2 100644 README
--- a/README
+++ b/README
@@ -522,6 +522,22 @@ tg base
repository, so you will not see work done by your
collaborators.)
+tg prev
+~~~~~~~
+ Outputs the direct dependencies for the current or named patch.
+
+ Options:
+ -i show dependencies based on index instead of branch
+ -w show dependencies based on working tree instead of branch
+
+tg next
+~~~~~~~
+ Outputs all patches which directly depend on the current or
+ named patch.
+
+ Options:
+ -i show dependencies based on index instead of branch
+ -w show dependencies based on working tree instead of branch
TODO: tg rename
diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash
index 0ee233c..fd17d5c 100755 contrib/tg-completion.bash
--- a/contrib/tg-completion.bash
+++ b/contrib/tg-completion.bash
@@ -426,6 +426,38 @@ _tg_update ()
COMPREPLY=()
}
+_tg_next ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+
+ case "$cur" in
+ -*)
+ __tgcomp "
+ -i
+ -w
+ "
+ ;;
+ *)
+ __tgcomp "$(__tg_topics)"
+ esac
+}
+
+_tg_prev ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+
+ case "$cur" in
+ -*)
+ __tgcomp "
+ -i
+ -w
+ "
+ ;;
+ *)
+ __tgcomp "$(__tg_topics)"
+ esac
+}
+
### }}}
### {{{ tg completion
@@ -471,7 +503,9 @@ _tg ()
import) _tg_import ;;
info) _tg_info ;;
mail) _tg_mail ;;
+ next) _tg_next ;;
patch) _tg_patch ;;
+ prev) _tg_prev ;;
push) _tg_push ;;
remote) _tg_remote ;;
summary) _tg_summary ;;
diff --git a/tg-next.sh b/tg-next.sh
new file mode 100644
index 0000000..9b352b3 tg-next.sh
--- /dev/null
+++ b/tg-next.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# TopGit - A different patch queue manager
+# (c) Petr Baudis <pasky@suse.cz> 2008
+# (c) Bert Wesarg <Bert.Wesarg@googlemail.com> 2009
+# GPLv2
+
+name=
+head_deps=
+
+
+## Parse options
+
+while [ -n "$1" ]; do
+ arg="$1"; shift
+ case "$arg" in
+ -i)
+ head_deps='(i)';;
+ -w)
+ head_deps='(w)';;
+ -*)
+ echo "Usage: tg next [-i | -w] [NAME]" >&2
+ exit 1;;
+ *)
+ [ -z "$name" ] || die "name already specified ($name)"
+ name="$arg";;
+ esac
+done
+
+head="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
+[ -n "$name" ] || name=$head
+
+git for-each-ref --format='%(refname)' refs/top-bases |
+ while read ref; do
+ parent="${ref#refs/top-bases/}"
+
+ deps_src=$parent
+ # select .topdeps source for HEAD branch
+ [ "x$parent" = "x$head" -a -n "$head_deps" ] &&
+ deps_src=$head_deps
+
+ cat_file "$deps_src":.topdeps | fgrep -qx "$name" ||
+ continue
+
+ echo "$parent"
+ done
diff --git a/tg-prev.sh b/tg-prev.sh
new file mode 100644
index 0000000..efef410 tg-prev.sh
--- /dev/null
+++ b/tg-prev.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+# TopGit - A different patch queue manager
+# (c) Petr Baudis <pasky@suse.cz> 2008
+# (c) Bert Wesarg <Bert.Wesarg@googlemail.com> 2009
+# GPLv2
+
+name=
+head_deps=
+
+
+## Parse options
+
+while [ -n "$1" ]; do
+ arg="$1"; shift
+ case "$arg" in
+ -i)
+ head_deps='(i)';;
+ -w)
+ head_deps='(w)';;
+ -*)
+ echo "Usage: tg next [-i | -w] [NAME]" >&2
+ exit 1;;
+ *)
+ [ -z "$name" ] || die "name already specified ($name)"
+ name="$arg";;
+ esac
+done
+
+head="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
+[ -n "$name" ] || name=$head
+base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
+ die "not a TopGit-controlled branch"
+
+deps_src=$name
+# select .topdeps source for HEAD branch
+[ "x$name" = "x$head" -a -n "$head_deps" ] &&
+ deps_src=$head_deps
+cat_file "$deps_src:.topdeps"
--
tg: (9404aa1..) bw/next-prev-base (depends on: master)
next prev parent reply other threads:[~2010-10-03 21:26 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-03 19:15 planning a new topgit release Uwe Kleine-König
2010-10-03 21:21 ` Bert Wesarg
2010-10-03 21:25 ` [TopGit PATCH 1/6] Let tg-update take a branch parameter Bert Wesarg
2010-10-03 21:25 ` [TopGit PATCH 2/6] tg-remote: use default remote if non is given Bert Wesarg
2010-10-03 21:25 ` [TopGit PATCH 3/6] tg-files: list files changed by the topic branch Bert Wesarg
2010-10-03 21:25 ` Bert Wesarg [this message]
2010-10-03 21:25 ` [TopGit PATCH 5/6] put die() messages to stderr Bert Wesarg
2010-10-03 21:25 ` [TopGit PATCH 6/6] tg-log: short cut to git log Bert Wesarg
[not found] ` <AANLkTi=Kwx5avY7xRdWLS931zK2fi7cj5Q8u3++bqRO+@mail.gmail.com>
2010-10-04 6:45 ` Bert Wesarg
2010-10-04 19:06 ` [TopGit PATCH] tg-log: move note from tg base to tg log Bert Wesarg
2010-10-04 21:05 ` Štěpán Němec
2010-10-04 21:08 ` Bert Wesarg
2010-10-04 6:45 ` [TopGit PATCH 6/6] tg-log: short cut to git log Uwe Kleine-König
2010-10-03 21:55 ` [TopGit PATCH 4/6] tg-prev/tg-next: commands to explore dependencies Uwe Kleine-König
2010-10-04 6:48 ` Bert Wesarg
2010-10-03 22:03 ` [TopGit PATCH 3/6] tg-files: list files changed by the topic branch Uwe Kleine-König
2010-10-04 6:43 ` Bert Wesarg
2010-10-04 6:47 ` Uwe Kleine-König
2010-10-04 6:50 ` Bert Wesarg
2010-10-04 6:59 ` Uwe Kleine-König
2010-10-04 13:16 ` [TopGit PATCH] " Bert Wesarg
2010-10-04 13:52 ` Uwe Kleine-König
2010-10-04 16:02 ` Bert Wesarg
2010-10-04 18:27 ` [TopGit PATCH v3] " Bert Wesarg
2010-10-04 20:09 ` [TopGit PATCH] tg-patch: use pretty_tree Bert Wesarg
2010-10-04 23:02 ` Bert Wesarg
2010-10-05 7:18 ` Uwe Kleine-König
2010-10-05 8:05 ` Bert Wesarg
2010-10-05 19:04 ` [TopGit PATCH v2] " Bert Wesarg
2010-10-05 20:01 ` Uwe Kleine-König
2010-10-05 20:14 ` Bert Wesarg
2010-10-05 7:17 ` [TopGit PATCH v3] tg-files: list files changed by the topic branch Uwe Kleine-König
2010-10-05 19:03 ` [TopGit PATCH v4] " Bert Wesarg
2010-10-05 22:02 ` Štěpán Němec
2010-10-06 6:11 ` Bert Wesarg
2010-10-03 22:00 ` [TopGit PATCH 2/6] tg-remote: use default remote if non is given Uwe Kleine-König
2010-10-04 3:13 ` Ævar Arnfjörð Bjarmason
2010-10-04 6:43 ` Uwe Kleine-König
2010-10-03 22:11 ` planning a new topgit release Uwe Kleine-König
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=1286141157-30422-4-git-send-email-bert.wesarg@googlemail.com \
--to=bert.wesarg@googlemail.com \
--cc=ceder@lysator.liu.se \
--cc=git@vger.kernel.org \
--cc=madduck@madduck.net \
--cc=odabrunz@gmx.net \
--cc=pasky@suse.cz \
--cc=simons@cryp.to \
--cc=thomas.moschny@gmx.de \
--cc=u.kleine-koenig@pengutronix.de \
/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).