it will detect that you are on a topic branch base ref and
resume the topic branch creation operation.
+ In an alternative use case, if '-r BRANCH' is given instead
+ of dependency list, the topic branch is created based on
+ the given remote branch.
+
tg delete
~~~~~~~~~
Remove a TopGit-controlled topic branch of given name
In case your dependencies are not up-to-date, tg update
will first recurse into them and update these.
+ If a remote branch update brings dependencies on branches
+ not yet instantiated locally, you can either bring in all
+ the new branches from the remote using 'tg remote --populate'
+ or only pick out the missing ones using 'tg create -r'
+ ('tg summary' will point out branches with incomplete
+ dependencies by showing an '!' near to them).
+
TODO: tg update -a for updating all topic branches
TODO: Some infrastructure for sharing topic branches between
restarted= # Set to 1 if we are picking up in the middle of base setup
merge= # List of branches to be merged; subset of $deps
name=
+rname= # Remote branch to base this one on
## Parse options
while [ -n "$1" ]; do
arg="$1"; shift
case "$arg" in
+ -r)
+ rname="$1"; shift;;
-*)
- echo "Usage: tg [...] create NAME [DEPS...]" >&2
+ echo "Usage: tg [...] create NAME [DEPS...|-r RNAME]" >&2
exit 1;;
*)
if [ -z "$name" ]; then
done
+## Fast-track creating branches based on remote ones
+
+if [ -n "$rname" ]; then
+ [ -n "$name" ] || die "no branch name given"
+ ! ref_exists "$name" || die "branch '$name' already exists"
+ has_remote "$rname" || die "no branch $rname in remote $base_remote"
+
+ git update-ref "refs/top-bases/$name" "refs/remotes/$base_remote/top-bases/$rname"
+ git update-ref "refs/heads/$name" "refs/remotes/$base_remote/$rname"
+ info "Topic branch $name based on $base_remote : $rname set up."
+ exit 0
+fi
+
+
## Auto-guess dependencies
deps="${deps# }"