git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Petr Baudis <pasky@suse.cz>
Cc: Bert Wesarg <bert.wesarg@googlemail.com>,
	git@vger.kernel.org, martin f krafft <madduck@debian.org>,
	u.kleine-koenig@pengutronix.de
Subject: [TopGit PATCH] tg-tred: Print the transitive reduction of the dependecies
Date: Wed, 25 Mar 2009 11:35:41 +0100	[thread overview]
Message-ID: <1237977341-32173-1-git-send-email-bert.wesarg@googlemail.com> (raw)

This uses the tred(1) and gvpr(1) program from the graphviz package to reduce
the dependencies of the given TopGit branch.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>

---
 .gitignore |    2 ++
 README     |   22 ++++++++++++++++++++++
 tg-tred.sh |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index eb56446..1061d93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,8 @@
 /tg-patch.txt
 /tg-summary
 /tg-summary.txt
+/tg-tred
+/tg-tred.txt
 /tg-update
 /tg-update.txt
 /tg-export
diff --git a/README b/README
index d2f095d..a941cb6 100644
--- a/README
+++ b/README
@@ -480,6 +480,28 @@ tg update
 
 	TODO: tg update -a for updating all topic branches
 
+tg tred
+~~~~~~~
+	Prints the transitive reduction of the dependecies for the current
+	or named TopGit branch.
+
+	To actually use this reduced dependencies list, feed the output into
+	the .topdeps file, commit and run tg update, like:
+
+	$ tg tred > .topdeps
+	$ tg add -f .topdeps
+	$ git commit -m "transitive reduce TopGit dependencies"
+	$ tg update
+
+	If you want to see the differences to the current dependencies, run
+	this:
+
+	$ diff -u -L current -L tred <(git show :.topdeps) <(tg tred)
+
+	TODO: tg tred -a for reducing all branches
+	TODO: tg tred -r for reducing recursive all from the current/named
+	      branch
+
 TODO: tg rename
 
 
diff --git a/tg-tred.sh b/tg-tred.sh
new file mode 100644
index 0000000..f41e051
--- /dev/null
+++ b/tg-tred.sh
@@ -0,0 +1,47 @@
+#!/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=
+
+
+## Parse options
+
+while [ -n "$1" ]; do
+	arg="$1"; shift
+	case "$arg" in
+	-*)
+		echo "Usage: tg [...] tred [NAME]" >&2
+		exit 1;;
+	*)
+		[ -z "$name" ] || die "name already specified ($name)"
+		name="$arg";;
+	esac
+done
+
+[ -n "$name" ] || name="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
+base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
+	die "not a TopGit-controlled branch"
+
+type tred >/dev/null 2>&1 ||
+	die "need the tred(1) tool from the graphviz package"
+type gvpr >/dev/null 2>&1 ||
+	die "need the gvpr(1) tool from the graphviz package"
+
+$tg summary --graphviz |
+	tred |
+	gvpr -a "\"${name}\"" '
+BEG_G {
+    node_t  ctr;
+    edge_t  e;
+
+    ctr = isNode($, ARGV[0]);
+    for (e = fstedge(ctr); e; e = nxtedge(e,ctr)) {
+        if (e.head.name != ARGV[0])
+            printf("%s\n", e.head.name);
+    }
+    exit(0);
+}
+'
-- 
tg: (fcb488d..) bw/tred (depends on: master)

             reply	other threads:[~2009-03-25 10:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-25 10:35 Bert Wesarg [this message]
2009-03-25 10:58 ` [TopGit PATCH] tg-tred: Print the transitive reduction of the dependecies Uwe Kleine-König
2009-03-25 11:20   ` Bert Wesarg
2009-03-25 11:24     ` Bert Wesarg

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=1237977341-32173-1-git-send-email-bert.wesarg@googlemail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=madduck@debian.org \
    --cc=pasky@suse.cz \
    --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.
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).