From: Bert Wesarg Date: Sun, 3 Oct 2010 21:25:57 +0000 (+0200) Subject: tg-log: short cut to git log X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=topgit.git;a=commitdiff_plain;h=ff59ac7fce3326e0b0163a780ecb49dd3b1de8d1 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 Signed-off-by: Uwe Kleine-König --- diff --git a/.gitignore b/.gitignore index 0342e09..3298889 100644 --- 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 15d20df..ce0c3a6 100644 --- a/README +++ b/README @@ -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 diff --git a/contrib/tg-completion.bash b/contrib/tg-completion.bash index 5aabc92..ccf1a32 100755 --- 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]}" @@ -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 ;; diff --git a/tg-log.sh b/tg-log.sh new file mode 100644 index 0000000..8a8d527 --- /dev/null +++ b/tg-log.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# TopGit - A different patch queue manager +# (c) Petr Baudis 2008 +# (c) Bert Wesarg 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"