Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tg-log: short cut to git log

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@googlemail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  • Loading branch information...
commit ff59ac7fce3326e0b0163a780ecb49dd3b1de8d1 1 parent 49df1c8
Bert Wesarg bertwesarg authored Uwe Kleine-König committed
Showing with 46 additions and 0 deletions.
  1. +2 −0  .gitignore
  2. +3 −0  README
  3. +11 −0 contrib/tg-completion.bash
  4. +30 −0 tg-log.sh
2  .gitignore
View
@@ -28,6 +28,8 @@
/tg-info.txt
/tg-mail
/tg-mail.txt
+/tg-log
+/tg-log.txt
/tg-patch
/tg-patch.txt
/tg-push
3  README
View
@@ -524,6 +524,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
11 contrib/tg-completion.bash
View
@@ -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]}"
@@ -475,6 +485,7 @@ _tg ()
help) _tg_help ;;
import) _tg_import ;;
info) _tg_info ;;
+ log) _tg_log ;;
mail) _tg_mail ;;
patch) _tg_patch ;;
push) _tg_push ;;
30 tg-log.sh
View
@@ -0,0 +1,30 @@
+#!/bin/sh
+# TopGit - A different patch queue manager
+# (c) Petr Baudis <pasky@suse.cz> 2008
+# (c) Bert Wesarg <Bert.Wesarg@googlemail.com> 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"
Please sign in to comment.
Something went wrong with that request. Please try again.