TODO: '-a' to delete all empty branches, depfix, revert
+tg depend
+~~~~~~~~~
+ Change dependencies of a TopGit-controlled topic branch.
+ This should have several subcommands, but only 'add' is
+ supported right now.
+
+ The 'add' subcommand takes an argument of a topic branch
+ to be added, adds it to '.topdeps', performs a commit and
+ then updates your topic branch accordingly. If you want to
+ do other things related to the dependency addition, like
+ adjusting '.topmsg', prepare them in the index before
+ calling 'tg depend add'.
+
tg info
~~~~~~~
Show a summary information about the current or specified
--- /dev/null
+#!/bin/sh
+# TopGit - A different patch queue manager
+# (c) Petr Baudis <pasky@suse.cz> 2008
+# GPLv2
+
+name=
+
+
+## Parse options
+
+subcmd="$1"; shift
+[ "$subcmd" = "add" ] || die "unknown subcommand ($subcmd)"
+
+while [ -n "$1" ]; do
+ arg="$1"; shift
+ case "$arg" in
+ -*)
+ echo "Usage: tg [...] depend add NAME" >&2
+ exit 1;;
+ *)
+ [ -z "$name" ] || die "name already specified ($name)"
+ name="$arg";;
+ esac
+done
+
+
+## Sanity checks
+
+[ -n "$name" ] || die "no branch name specified"
+branchrev="$(git rev-parse --verify "$name" 2>/dev/null)" ||
+ die "invalid branch name: $name"
+baserev="$(git rev-parse --verify "refs/top-bases/$name" 2>/dev/null)" ||
+ die "not a TopGit topic branch: $name"
+
+
+## Record new dependency
+
+echo "$name" >>.topdeps
+git add .topdeps
+git commit -m"New TopGit dependency: $name"
+$tg update