[TopGit PATCH 6/6] tg-log: short cut to git log

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

 



A short cut to show the history of a named topgit branch.  Additional options
to git log can be given after a '--'.

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

---
 .gitignore                 |    2 ++
 README                     |    3 +++
 contrib/tg-completion.bash |   11 +++++++++++
 tg-log.sh                  |   30 ++++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0342e09..3298889 100644 .gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -28,6 +28,8 @@
 /tg-info.txt
 /tg-mail
 /tg-mail.txt
+/tg-log
+/tg-log.txt
 /tg-patch
 /tg-patch.txt
 /tg-push
diff --git a/README b/README
index f103d92..b5fdaaf 100644 README
--- a/README
+++ b/README
@@ -522,6 +522,9 @@ tg base
 	repository, so you will not see work done by your
 	collaborators.)
 
+tg log
+~~~~~~
+	Prints the git log of the named topgit branch.
 
 TODO: tg rename
 
diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash
index 0ee233c..c65398a 100755 contrib/tg-completion.bash
--- a/contrib/tg-completion.bash
+++ b/contrib/tg-completion.bash
@@ -344,6 +344,16 @@ _tg_info ()
 	esac
 }
 
+_tg_log ()
+{
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+
+	case "$cur" in
+	*)
+		__tgcomp "$(__tg_topics)"
+	esac
+}
+
 _tg_mail ()
 {
 	local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -470,6 +480,7 @@ _tg ()
 	help)        _tg_help ;;
 	import)      _tg_import ;;
 	info)        _tg_info ;;
+	log)         _tg_log ;;
 	mail)        _tg_mail ;;
 	patch)       _tg_patch ;;
 	push)        _tg_push ;;
diff --git a/tg-log.sh b/tg-log.sh
new file mode 100644
index 0000000..8a8d527 tg-log.sh
--- /dev/null
+++ b/tg-log.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# TopGit - A different patch queue manager
+# (c) Petr Baudis <pasky@xxxxxxx>  2008
+# (c) Bert Wesarg <Bert.Wesarg@xxxxxxxxxxxxxx>  2009
+# GPLv2
+
+name=
+
+
+## Parse options
+
+while [ -n "$1" ]; do
+	arg="$1"; shift
+	case "$arg" in
+	--)
+		break;;
+	-*)
+		echo "Usage: tg [...] log [NAME] [-- GIT LOG OPTIONS...]" >&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/##')"
+base_rev="$(git rev-parse --short --verify "refs/top-bases/$name" 2>/dev/null)" ||
+	die "not a TopGit-controlled branch"
+
+git log --first-parent --no-merges "$@" "refs/top-bases/$name".."$name"
-- 
tg: (9404aa1..) bw/log (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]