Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
- 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.
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+
+ case "$cur" in
+ *)
+ __tgcomp "$(__tg_topics)"
+ esac
-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"