From: Petr Baudis Date: Wed, 24 Sep 2008 17:03:29 +0000 (+0200) Subject: tg depend add: Add dependency X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=commitdiff_plain;h=d272e32afc116764cf2afc1033320953466f5ed5;ds=sidebyside tg depend add: Add dependency --- diff --git a/README b/README index 5fe7d09..7b117b8 100644 --- a/README +++ b/README @@ -253,6 +253,19 @@ tg delete 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 diff --git a/tg-depend.sh b/tg-depend.sh new file mode 100644 index 0000000..af78808 --- /dev/null +++ b/tg-depend.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# TopGit - A different patch queue manager +# (c) Petr Baudis 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