[TopGit PATCH 1/6] Let tg-update take a branch parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Bert Wesarg <bert.wesarg@xxxxxxxxxxxxxx>

---
 README                     |    6 ++++--
 contrib/tg-completion.bash |    7 ++++++-
 tg-update.sh               |   18 ++++++++++++------
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/README b/README
index c418ff4..dba2345 100644 README
--- a/README
+++ b/README
@@ -472,13 +472,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.
 
diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash
index 0ee233c..5aabc92 100755 contrib/tg-completion.bash
--- a/contrib/tg-completion.bash
+++ b/contrib/tg-completion.bash
@@ -423,7 +423,12 @@ _tg_summary ()
 
 _tg_update ()
 {
-	COMPREPLY=()
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+
+	case "$cur" in
+	*)
+		__tgcomp "$(__tg_topics)"
+	esac
 }
 
 ### }}}
diff --git a/tg-update.sh b/tg-update.sh
index 73280c6..b256c7c 100644 tg-update.sh
--- a/tg-update.sh
+++ b/tg-update.sh
@@ -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"
 
-- 
tg: (29ab4cf..) bw/update-does-checkout (depends on: master)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]