chiark / gitweb /
Let tg-update take a branch parameter
authorBert Wesarg <bert.wesarg@googlemail.com>
Sun, 3 Oct 2010 21:25:52 +0000 (23:25 +0200)
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Sun, 3 Oct 2010 22:06:48 +0000 (00:06 +0200)
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
README
contrib/tg-completion.bash
tg-update.sh

diff --git a/README b/README
index 9bab4defb385acc3a377750414de8167558c613e..dec299f009892922b13c8f199fd53a12a678603e 100644 (file)
--- a/README
+++ b/README
@@ -483,13 +483,15 @@ tg import
 
 tg update
 ~~~~~~~~~
 
 tg update
 ~~~~~~~~~
-       Update the current topic branch wrt. changes in the branches
-       it depends on and remote branches.
+       Update the current or specified topic branch wrt. changes in the
+       branches it depends on and remote branches.
        This is performed in two phases - first,
        changes within the dependencies are merged to the base,
        then the base is merged into the topic branch.
        The output will guide you in case of conflicts.
 
        This is performed in two phases - first,
        changes within the dependencies are merged to the base,
        then the base is merged into the topic branch.
        The output will guide you in case of conflicts.
 
+       After the update the current branch is the specified one.
+
        In case your dependencies are not up-to-date, tg update
        will first recurse into them and update these.
 
        In case your dependencies are not up-to-date, tg update
        will first recurse into them and update these.
 
index 0ee233c4781b1fe8d3a84772c59373e30ed2f06f..5aabc922733c1f18b149581f6e60310802e615af 100755 (executable)
@@ -423,7 +423,12 @@ _tg_summary ()
 
 _tg_update ()
 {
 
 _tg_update ()
 {
-       COMPREPLY=()
+       local cur="${COMP_WORDS[COMP_CWORD]}"
+
+       case "$cur" in
+       *)
+               __tgcomp "$(__tg_topics)"
+       esac
 }
 
 ### }}}
 }
 
 ### }}}
index 73280c65af79af2da50204582c7029a00cfcef34..b256c7c270b41c4e8f5d384a7ece4011d07beb74 100644 (file)
@@ -8,13 +8,19 @@ name=
 
 ## Parse options
 
 
 ## Parse options
 
-if [ -n "$1" ]; then
-       echo "Usage: tg [...] update" >&2
-       exit 1
-fi
-
-
-name="$(git symbolic-ref HEAD | sed 's#^refs/\(heads\|top-bases\)/##')"
+while [ -n "$1" ]; do
+       arg="$1"; shift
+       case "$arg" in
+       -*)
+               echo "Usage: tg [...] update [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"
 
 base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
        die "not a TopGit-controlled branch"