Permalink
Browse files

Let tg-update take a branch parameter

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  • Loading branch information...
1 parent f7a99e1 commit 8d92943bcdb6eea3819dce28d2ff48dd8a061b31 @bertwesarg bertwesarg committed with Uwe Kleine-König Oct 3, 2010
Showing with 23 additions and 10 deletions.
  1. +4 −2 README
  2. +6 −1 contrib/tg-completion.bash
  3. +13 −7 tg-update.sh
View
@@ -483,13 +483,15 @@ tg import
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.
+ 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.
@@ -423,7 +423,12 @@ _tg_summary ()
_tg_update ()
{
- COMPREPLY=()
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+
+ case "$cur" in
+ *)
+ __tgcomp "$(__tg_topics)"
+ esac
}
### }}}
View
@@ -8,13 +8,19 @@ name=
## 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"

0 comments on commit 8d92943

Please sign in to comment.